<?php
	require '../biz/backend.php';

	class action extends backend
	{
		var $get_privilege_id = '87';

		function do_get()
		{
			$template = load( 'template', array( 'domain'=>'tpl.admin' ) );

			$tpl = load( 'biz.tag' );
			$result = $tpl->get( $this->input );

			$template->assign( 'data', $result);
			$template->appoint( $this->input );
			$template->assign( 'reference', isset( $this->input['reference'] ) ? urldecode( $this->input['reference'] ) : config( 'server.HTTP_REFERER' ) );
			echo $template->parse( 'edit_tag.php' );
		}

		/**
		 * description
		 * detail description
		 * @param string user
		 * @param integer id
		 * @return int|string|array|object|mixed
		 */
		function do_post(  )
		{
			$url = isset( $this->input['reference'] ) ? $this->input['reference'] : config( 'domain.admin' ) . 'list_tag.php';
			unset( $this->input['reference'] );

			$config = load( 'biz.tag' );
			$result = $config->set( $this->input );

			if ( $result['success'] )
			{
				$this->prompt( '成功修改配置参数', array( array( 'url' => config( 'domain.admin' ) . 'edit_tag.php?id=' . $result['data']['id'] . '&reference=' . urlencode( $url ), 'name' => '继续修改' ), array( 'url' => $url, 'name' => '返回列表' ) ) );
			}
			else
			{
				$this->prompt( '修改失败', $this->transform( $result['message'], config( 'server.HTTP_REFERER' ) ) );
			}
		}

		//因要传递php代码，故覆盖此方法
		function clean( & $array )
		{
			return $array;
		}


	}

	$action = new action();
	$action->run();
?>